再來是更頭暈~更重要的流程控制~實務必用
1- 選擇結構
If又可以再細分為
只能處理一個條件事的if和
If…else….
做個範例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
    $score=61;
    if($score>60)
    echo'及格~';
    else
    echo'不及格~';
    ?>
</body>
</html>

多個條件式:
範例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
    $mynum = 100;
    
    if($mynum == 100){
        echo "很棒喔~滿分100分";
    }
    ?>
</body>
</html>
if +else 否則就.....

兩個等號才是相等

這樣寫0會出現不及格..但是不會寫補考...所以有錯...


要改寫成這樣子才對~


switch
2-	迴圈結構
3-	for-
先來練習幾個我覺得面試必考的for無窮迴圈+加總+1~10的相乘~
面試不會就是先背起來~
先進去再說~GOGO

for無窮迴圈

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
for($i=1;$i<=10;$i++)
echo $i.'<br>';
    ?>
</body>
</html>
+加總=1~50之間所有偶數的總和
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
    $sum = 0;
    for($i=1; $i <=50; $i+=1)
    $sum=$sum+$i;
    echo'1到50之間所有偶數的總和'.$sum;
    ?>
</body>
</html>
+1~10的相乘~

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
$result=1;
for($i =1;$i <=10;$i++)
$result = $result*$i;
echo'1~10相乘為'.$result;
    ?>
</body>
</html>
4-	while
5-	do...while
6-	foreach
是不是頭很暈~這些是必學QQ
下一篇陣列~更常用~頭暈程度 我覺得比這裡好一點
就是放格子~ 只是是從0開始~SEE YOU